import { IPersonState } from '../State';
import { MinLengthValidator } from '../Validators/MinLengthValidator';
import { IValidation } from './IValidation';


/**
 * 地址验证
 * 地址必须大于4个字符
 */
export class AddressValidation implements IValidation {
    private readonly minLengthValidator: MinLengthValidator = new MinLengthValidator(4);
    public Validate(state: IPersonState, errors: string[]): void {
        if (!this.minLengthValidator.IsValid(state.Address)) {
            errors.push("地址至少需要");
        }
    }
}